import{j as s,B as t,c as l,R as c}from"./animations-CgUupe92.js";import{u as d,a as h,H as m,C as i,T as y,A as x,M as j,b as p}from"./ChartCard-D9dwQTKH.js";function u(){const{history:r,loading:o,error:a,refetch:n}=d({maxResults:1e5}),e=h(r);return o?s.jsx("div",{className:"history-app",children:s.jsxs("div",{className:"loading",children:[s.jsx("div",{className:"spinner"}),s.jsx("p",{children:"Analyzing your browsing history for longevity insights..."})]})}):a?s.jsx("div",{className:"history-app",children:s.jsxs("div",{className:"error-state",children:[s.jsx("h2",{children:"Error Loading History"}),s.jsx("p",{children:a}),s.jsx(t,{onClick:n,children:"Try Again"})]})}):r.length===0?s.jsx("div",{className:"history-app",children:s.jsxs("div",{className:"empty-state",children:[s.jsx("h2",{children:"No History Available"}),s.jsx("p",{children:"No browsing history found. Please browse some websites first, then try again."})]})}):s.jsxs("div",{className:"history-app",children:[s.jsxs("header",{className:"app-header",children:[s.jsx("h1",{children:"🌱 Longevity History Analytics"}),s.jsxs("div",{className:"header-actions",children:[s.jsx(t,{onClick:()=>window.location.href="newtab.html",children:"← Back"}),s.jsx(t,{onClick:n,children:"🔄 Refresh"})]})]}),s.jsxs("div",{className:"history-content",children:[s.jsx(m,{stats:e}),s.jsx(i,{title:"Time Spent per Domain",children:s.jsx(y,{timeSpentByDomain:e.timeSpentByDomain,limit:15})}),s.jsx(i,{title:"Hourly Activity Pattern",children:s.jsx(x,{hourlyPattern:e.hourlyPattern})}),s.jsx(i,{title:"Most Visited Sites",children:s.jsx(j,{timeSpentByDomain:e.timeSpentByDomain,limit:15})}),s.jsx(i,{title:"Weekly Activity Pattern",children:s.jsx(p,{dailyPattern:e.dailyPattern})})]})]})}const v=l.createRoot(document.getElementById("root"));v.render(s.jsx(c.StrictMode,{children:s.jsx(u,{})}));
